﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetDocumentStepID]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetDocumentStepID];
GO
CREATE PROCEDURE [dbo].[sproc_GetDocumentStepID]
    @DocID int
AS
DECLARE @StepID INT

SET @StepID = 0

IF EXISTS(SELECT 1 FROM uds_flow_document WHERE doc_id = @docid)
BEGIN
    SELECT     @StepID = Step_id 
        FROM     uds_flow_document
        WHERE     doc_id = @docid
    RETURN @StepID
END
    RETURN -1